package ouc.pkere.utils.generator.utils;

import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;

public class CommonUtils {

    /**
     * 将所生成的代码字符串保存至Java源代码文件
     */
    public static void codeToSrcFile(String filePath, String content) {

        try {
            FileWriter fileWriter = new FileWriter(filePath);
            PrintWriter printWriter = new PrintWriter(fileWriter);
            printWriter.println(content);
            printWriter.flush();
            printWriter.close();

        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}
